<?php
/**
 * 用户的教育经历信息
 *
 * @author 耿鸿飞 <15911185633>
 */
class Resume_Edu extends Model
{
    protected $tbl = 'resume_edu';
    /**
     * 添加教育经历
     * @param type $uid
     * @param type $univid
     * @param type $schoolid
     * @param type $majar
     * @param type $degree
     * @param type $startdata
     * @param type $enddata
     * @return type
     */
    public function addEdu($uid,$univid,$schoolid,$majar,$degree,$startdata,$enddata = null){
        $data = array(
            'Fuid' => $uid,
            'Funiv' => $univid,
            'Fschool' => $uid,
            'Fstart' => $startdata,
            'Fend' => $enddata,
            'Fmajor' => $majar,
            'Fdegree' => $degree,
        );
        return $this->insert($data);
    }
    /**
     * 删除教育经历
     * @param type $feid
     * @return type
     */
    public function delEdu($feid){
        $data = array("Fstatus" => 'Del');
        return $this->update($data,sprintf("Feid=%d",$feid));
    }
    /**
     * 编辑教育经历
     * @param type $feid
     * @param type $univid
     * @param type $schoolid
     * @param type $majar
     * @param type $degree
     * @param type $startdata
     * @param type $enddata
     * @return type
     */
    public function editEdu($feid,$univid,$schoolid,$majar,$degree,$startdata,$enddata = null){
        $data = array(
            'Funiv' => $univid,
            'Fschool' => $uid,
            'Fstart' => $startdata,
            'Fend' => $enddata,
            'Fmajor' => $majar,
            'Fdegree' => $degree,
        );
        return $this->update($datas,printf("Feid=%d",$feid));
    }
    /**
     * 获取一个用户的教育经历的列表
     * @param type $uid
     * @return type
     */
    public function getList($uid){
        $rs = array();
        $sql = sprintf("SELECT * FROM %s WHERE Fstatus='Yes' AND Fuid=%d ORDER Fstart DESC",  $this->tbl,$uid );
        $list = $this->getResults($sql);
        if($list){
            foreach($list AS $val){
                $rs[$val['Feid']] = $val;
            }
        }
        return $rs;
    }
}

?>
